package c.b.a.c.a.g;

import c.b.a.c.a.e.a;
import java.util.concurrent.Executor;

final class t<ResultT> extends e<ResultT> {

    /* renamed from: a  reason: collision with root package name */
    private final Object f2011a = new Object();

    /* renamed from: b  reason: collision with root package name */
    private final o<ResultT> f2012b = new o<>();

    /* renamed from: c  reason: collision with root package name */
    private boolean f2013c;

    /* renamed from: d  reason: collision with root package name */
    private ResultT f2014d;
    private Exception e;

    t() {
    }

    private final void h() {
        a.c(this.f2013c, "Task is not yet complete");
    }

    private final void k() {
        a.c(!this.f2013c, "Task is already complete");
    }

    private final void n() {
        synchronized (this.f2011a) {
            if (this.f2013c) {
                this.f2012b.a(this);
            }
        }
    }

    public final e<ResultT> a(a<ResultT> aVar) {
        this.f2012b.b(new i(f.f1989a, aVar));
        n();
        return this;
    }

    public final e<ResultT> b(Executor executor, b bVar) {
        this.f2012b.b(new k(executor, bVar));
        n();
        return this;
    }

    public final e<ResultT> c(Executor executor, c<? super ResultT> cVar) {
        this.f2012b.b(new m(executor, cVar));
        n();
        return this;
    }

    public final Exception d() {
        Exception exc;
        synchronized (this.f2011a) {
            exc = this.e;
        }
        return exc;
    }

    public final ResultT e() {
        ResultT resultt;
        synchronized (this.f2011a) {
            h();
            Exception exc = this.e;
            if (exc == null) {
                resultt = this.f2014d;
            } else {
                throw new d(exc);
            }
        }
        return resultt;
    }

    public final boolean f() {
        boolean z;
        synchronized (this.f2011a) {
            z = this.f2013c;
        }
        return z;
    }

    public final boolean g() {
        boolean z;
        synchronized (this.f2011a) {
            z = false;
            if (this.f2013c && this.e == null) {
                z = true;
            }
        }
        return z;
    }

    public final void i(Exception exc) {
        a.b(exc, "Exception must not be null");
        synchronized (this.f2011a) {
            k();
            this.f2013c = true;
            this.e = exc;
        }
        this.f2012b.a(this);
    }

    public final void j(ResultT resultt) {
        synchronized (this.f2011a) {
            k();
            this.f2013c = true;
            this.f2014d = resultt;
        }
        this.f2012b.a(this);
    }

    public final boolean l(Exception exc) {
        a.b(exc, "Exception must not be null");
        synchronized (this.f2011a) {
            if (this.f2013c) {
                return false;
            }
            this.f2013c = true;
            this.e = exc;
            this.f2012b.a(this);
            return true;
        }
    }

    public final boolean m(ResultT resultt) {
        synchronized (this.f2011a) {
            if (this.f2013c) {
                return false;
            }
            this.f2013c = true;
            this.f2014d = resultt;
            this.f2012b.a(this);
            return true;
        }
    }
}
